<% content_tag_for :div, task, :class=> "#{task.status} task" do %>
  <h1><%= task.name %></h1>
  <p class="status <%= task.status %>">Build status: <%= task.status %></p>

  <div class='task_description'>
  <% if task.prepared? %>
    <p>This tasks is prepared to be run. Please wait other tasks finish.</p>
    <pre id="output"><%= task.parsed_output %></pre>
    
  <% else  %>
    <dl>
      <dt>Started at:</dt>
      <dd><%= show_time(task.started_at) %></dd>
  
    <% if task.building? %>
      <dt>Elapsed time</dt>
      <dd class="elapsed_time"><%= show_elapsed(task.build_duration) %></dd>
      <dt>Pid</dt>
      <dd><%= task.pid %>
        <% form_for task, :url => project_task_path(@project,task) do |f| %>  
        <%= hidden_field_tag :kill, 'INT' %>
        <%= f.submit 'INT' %>
        <% end %>
      
        <% form_for task, :url => project_task_path(@project,task) do |f| %>  
        <%= hidden_field_tag :kill, 'QUIT' %>
        <%= f.submit 'QUIT' %>
        <% end %>
        
        <% form_for task, :url => project_task_path(@project,task) do |f| %>  
        <%= hidden_field_tag :kill, 'KILL' %>
        <%= f.submit 'QUIT' %>
        <% end %>
      
      </dd>
    <% else %>  
      <dt>Ended at:</dt>
      <dd><%= show_time(task.ended_at) %> 
        <span><%= show_elapsed(task.build_duration) %></span></dd>
    <% end %>
    <%= link_to 'raw', project_task_path(@project,task, 'text'), :class => 'raw_link' %>
    </dl>
    <pre id="output"><%= task.parsed_output %></pre>
  <% end %>
  </div>
<% end %>